package com.ruoyi.web.mnt.service.impl;

import cn.hutool.json.JSONUtil;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.workflow.api.IBpmBusinessExecutor;
import com.ruoyi.workflow.core.ExchangeDataDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 模拟请假流程业务处理过程，由于请假属于纯审批过程，此Executor实现仅用于测试
 *
 * @author Java Liu
 */
@Slf4j
@Component("myDemoBiz")
public class MyDemoBizExecutorImpl implements IBpmBusinessExecutor {
    @Override
    public void beforeCreateProcessValidate(ExchangeDataDTO exchangeDataDto) throws ServiceException {
        log.info("beforeCreateProcessValidate,exchangeDataDto:\n{}", JSONUtil.toJsonPrettyStr(exchangeDataDto));
    }

    @Override
    public void afterCreateProcess(ExchangeDataDTO exchangeDataDto) throws ServiceException {
        log.info("afterCreateProcess,exchangeDataDto:\n{}", JSONUtil.toJsonPrettyStr(exchangeDataDto));
    }

    @Override
    public void beforeCompleteTaskValidate(ExchangeDataDTO exchangeDataDto) throws ServiceException {
        log.info("beforeCompleteTaskValidate,exchangeDataDto:\n{}", JSONUtil.toJsonPrettyStr(exchangeDataDto));
    }

    @Override
    public void afterCompleteTask(ExchangeDataDTO exchangeDataDto) throws ServiceException {
        log.info("afterCompleteTask,exchangeDataDto:\n{}", JSONUtil.toJsonPrettyStr(exchangeDataDto));
    }

    @Override
    public void afterFinishProcess(ExchangeDataDTO exchangeDataDto) throws ServiceException {
        log.info("afterFinishProcess,exchangeDataDto:\n{}", JSONUtil.toJsonPrettyStr(exchangeDataDto));
    }

    @Override
    public void doProcessStatusChanged(ExchangeDataDTO exchangeDataDto) throws ServiceException {
        log.info("doProcessStatusChanged,exchangeDataDto:\n{}", JSONUtil.toJsonPrettyStr(exchangeDataDto));
    }

    @Override
    public void doTerminateProcess(ExchangeDataDTO exchangeDataDto) throws ServiceException {
        log.info("doTerminateProcess,exchangeDataDto:\n{}", JSONUtil.toJsonPrettyStr(exchangeDataDto));
    }

}
